#include <Windows.h>
#include <iostream>
#include <cassert>
#include "WalleLib.hpp"

#pragma comment(lib, "walle_lib.lib")

int main()
{
    HWND game_wnd = FindWindow(NULL, TEXT("Element Client"));
    //HWND game_wnd = FindWindow(NULL, TEXT("Q-Dir 4.52"));
    DWORD thread_id = GetWindowThreadProcessId(game_wnd, NULL);
    assert(thread_id != 0);
    assert(SetMessageHook(thread_id));
    MSG msg;
    while(GetMessage(&msg, NULL, 0, 0)){
        std::cout << "Hack tool(thread id = " << thread_id << ") h e a r t  b e a t ..." << std::endl;
        if (msg.message == WM_NULL){
            std::cout << "Receive the WM_NULL from the server" << std::endl;
            assert(SetMessageHook(0));
            return 0;			
        }
    }
    // HWND hack_wnd = ::FindWindow(NULL, TEXT("HACK"));
    // assert(IsWindow(hack_wnd));
    // ::SendMessage(hack_wnd, WM_APP, 0, 0);
}
